package cn.kw0501.tms.utils;

import lombok.Getter;

/**
 * 名称
 *
 * @Description :
 * @Author : JiaLe
 * @Date: 2022/8/8 19:51
 */
@Getter
public class JsonResult {
    private Integer code;
    private String msg;
    private Object data;

    public JsonResult(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static JsonResult ok(String msg){
        return new JsonResult(1000,msg==null?"操作成功":msg,null);
    }

    public static JsonResult ok(Object data){
        return new JsonResult(1000,"操作成功",data);
    }

    public static JsonResult err(Integer code,String msg){
        return new JsonResult(code,msg,null);
    }
}
